<?php
	$this->load->helper('url');
	$this->load->helper('form');
?>

<html>
<head>
    	<title>ICS SAIS</title>
      <link href="<?=base_url()?>style/design.css" rel="stylesheet" type="text/css" />   
<link rel="stylesheet" href="<?=base_url();?>js/jquery-ui.css" />
<script src="<?=base_url();?>js/jquery-1.9.1.js"></script>
  <script src="<?=base_url();?>js/jquery-ui.js"></script>
 

<script type="text/javascript">
	 var RecaptchaOptions = { theme : 'white' };
	
	function form_type_display() {
		if (document.getElementById('type').value == 'student') {
			var className = 'student_form';
		} else if(document.getElementById('type').value == 'faculty'){
			var className = 'faculty_form';
		} else if(document.getElementById('type').value == 'encoder'){
			var className = 'encoder_form'
		}
		
		<!--get elements by class-->
		<!--http://stackoverflow.com/questions/3808808/how-to-get-element-by-class-in-javascript-->
		var elems = document.getElementsByTagName('*'), i;
		for (i in elems) {
			if((' ' + elems[i].className + ' ').indexOf(' ' + className + ' ')
					> -1) {
				elems[i].style.display = 'table-row';
			}
		}
	}
	
	function disable_all_forms(){
		var elems = document.getElementsByTagName('*'), i;
		var form_names = new Array();
		form_names[0] = 'student_form';
		form_names[1] = 'faculty_form';
		form_names[2] = 'encoder_form';
		for (h in form_names){
			for (i in elems) {
				if((' ' + elems[i].className + ' ').indexOf(' ' + form_names[h] + ' ')
						> -1) {
					elems[i].style.display = 'none';
				}
			}
		}
	}
</script>   

<script>
/*Change password jQuery*/
	/*Source:
		http://jqueryui.com/dialog/#modal-form
	*/
 $(function() {
    var name = $( "#name" ),
      email = $( "#email" ),
      password = $( "#password" ),
      allFields = $( [] ).add( name ).add( email ).add( password ),
      tips = $( ".validateTips" );
	  

    function updateTips( t ) {
      tips
        .text( t )
        .addClass( "ui-state-highlight" );
      setTimeout(function() {
        tips.removeClass( "ui-state-highlight", 1500 );
      }, 500 );
    }
 
    $( "#dialog-form" ).dialog({
      autoOpen: false,
      height: 250,
      width: 400,
      modal: true,
      buttons: {
        "Change Password": function() {
            //submit form to database
			$("#form_changepassword").submit();
            $( this ).dialog( "close" );
        },
        Cancel: function() {
          $( this ).dialog( "close" );
        }
      },
      close: function() {
        allFields.val( "" ).removeClass( "ui-state-error" );
      }
    });
 
    $( "#change_pw" )
      .click(function() {
        $( "#dialog-form" ).dialog( "open" );
      });
  });
/*Change password jQuery*/
	

</script>        

</head>
    
<body>
   	<div id="cont">
        	<div id="header_slim">
            	<div id="header_main">
                	<div id="mhleft">
                    </div>
                    
                    <div id="mhcenter">
                    		<img src="<?=base_url()?>style/ics_logo_blue.png" id="logo"/>
                      <div id="label_sais">
                        	<div id="border_label">	</div>
                        <div id="label"><p>Students'Academic
Information System</p></div>
                      </div>
                  </div>
                    
                    <div id="mhright">
                    </div>
                </div>
   
                <div id="bottomhead">
                	<div id="bhleft_slim">
                    </div>
                    <div id="menu_bar_slim">
                    	<!--menu -->
						<?php
							$this->load->helper('url');
						?>
						<div class="header_link">
							<h>Logged in as: <?=$this->session->userdata('user');?></h>
						</div>
                        <div class="header_link">
                        	<?php echo anchor('home/instructorInfo','<h>Basic Info</h>'); ?>
                        </div>
                        <ul id="nav">
                            <li>
                                <div class="header_link">
                                  <a><h>Advisees</h></a>
                                </div>
                                <ul>
                                  <div id="drop_down">
                                    <li><?php echo anchor('home/viewStudents/reg','<h>Registration Advisees</h>'); ?>
                                    <li><?php echo anchor('home/viewStudents/sp','<h>SP Advisees</h>'); ?>
                                  </div>
                                </ul>  
                            </li>
                        </ul>
                         <ul id="nav">
                            <li>
                                <div class="header_link">
                                  <a><h>Students</h></a>
                                </div>
                                <ul>
                                  <div id="drop_down">
                                    <li><?php echo anchor('home/viewSubjects/list','<h>Prerequisite</h>'); ?>
                                    <li><?php echo anchor('home/viewSubjects/previous','<h>Previous Students</h>'); ?>
                                    <li><?php echo anchor('home/viewSubjects/studentList','<h>Student List</h>'); ?>
                                  </div>
                                </ul>  
                            </li>
                        </ul>
                        <div class="header_link">
                            <?php echo anchor('home/viewInstructorSchedule','<h>Schedule</h>'); ?>
                        </div>
                        <div class="header_link">
                         <?php echo anchor('home/logout', '<h>Log out</h>');?>
                        </div>                        
                    </div>
                </div>
            </div>
            
      <div id="body_user">
      	<div id="body_border_user">	<!--light blue border-->
        </div>
        <div id="main_body">
           <?php
                if($typeofsubject == 'list'){
                  echo form_open("home/subjectSearchCourse");
                  echo 'Search Course: <input type="text" name="searchCourse" placeholder="CMSCXXX" autofocus="autofocus" />';
                  echo '<input type="submit" value="Search">';
                  echo form_close(); //validation
                }else if($typeofsubject == 'previous'){
                  echo form_open('home/subjectSearchAcadYear');
                  echo 'Search Academic Year:';
                      $acadYear = array(
                      '1995-1996'  => '1995-1996',
                      '1996-1997'    => '1996-1997',
                      '1997-1998'   => '1997-1998',
                      '1998-1999' => '1998-1999',
                      '1999-2000' => '1999-2000',
                      '2000-2001' => '2000-2001',
                      '2001-2002' => '2001-2002',
                      '2002-2003' => '2002-2003',
                      '2003-2004' => '2003-2004',
                      '2004-2005' => '2004-2005',
                      '2005-2006' => '2005-2006',
                      '2006-2007' => '2006-2007',
                      '2007-2008' => '2007-2008',
                      '2008-2009' => '2008-2009',
                      '2009-2010' => '2009-2010',
                      '2010-2011' => '2010-2011',
                      '2011-2012' => '2011-2012',
                      '2012-2013' => '2012-2013',
                    );
                  echo form_dropdown('searchAcadYear', $acadYear, '1995-1996');
                  echo 'Search Semester:';
                    $sem = array(
                      'first' => 'First',
                      'second' => 'Second',
                      'summer' => 'Summer',
                      );
                  echo form_dropdown('searchSem', $sem, 'first');
                  echo '<input type="submit" value="Submit" />';
                  echo form_close(); //validation
                }else if($typeofsubject == 'studentList'){
                  //  echo form_open('home/viewStudentList');
                    echo anchor('home/viewStudentList','<h1>Student List</h1>');
              /*    echo form_open('home/subjectSearchStudentBasicInfo');
                  echo '<table border = 1>';
                  foreach($instructor as $row){
                    echo '<tr><td>'.$row->Last_Name.'</td>';
                    echo '<td>'.$row->Student_No.'</td></tr>';
                  }
                  echo '</table>';
                  echo '<br/>';
                  echo 'Search Student by Student Number: <input type="text" name="searchStudentBasic" pattern="(199[5-9]-[0-9]{5})|200[0-9]-[0-9]{5}|201[0-3]-[0-9]{5}" title="(1995-2013)-XXXXX" autofocus = "autofocus" />';
                  echo '<input type="submit" value="Search "/>';*/
                  echo form_close();
                
                }
              ?>

          
           
         </div>
       </div>
      </div>
	</div>
</body>